package com.leyou.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.ArrayList;

/**
 * @author xhh
 * @date 2022/4/2
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket docket1(){
        return new Docket(DocumentationType.OAS_30)
                .apiInfo(apiInfo()).enable(true).groupName("xhh").select().apis(RequestHandlerSelectors.basePackage("com.leyou.personnel.controller")).build();
    }
    //@Bean
    //public Docket docket2(){
    //    return new Docket(DocumentationType.OAS_30)
    //            .apiInfo(apiInfo()).enable(true).groupName("sjh").select().build();
    //}
    private ApiInfo apiInfo(){
        return new ApiInfo("标题",
                "描述",
                "1.2",
                "www.baidu.com",
                new Contact("xhh","wd","2157029691@qq.com"),
                "证书",
                "证书地址",
                new ArrayList()
        );
    }
}
